#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<string>
#include<string.h>
#include<stdlib.h>
using namespace std;
namespace str
{
	class string
	{
	public:
		string(const char* str = "")
			: _size(strlen(str))
			, _capacity(_size + 1)
		{
			_str = new char[_capacity + 1];
			strcpy(_str, str);
		}
		~string()
		{
			delete[] _str;
			_size = 0;
			_capacity = 0;
		}
	/*	char& operator[](int d1)
		{
			return _str[d1];
		}*/
		void reserved(size_t d1)
		{
			char* cut = new char[d1 + 1];
			//memcpy(cut, _str, _size);
			strcpy(cut, _str);
			delete[] _str;
			_str = cut;
			_capacity = d1;
		}
		size_t size()
		{
			return _size;
		}
		size_t capacity()
		{
			return _capacity;
		}
		void push_back(char d1)
		{
			if (_size == _capacity)
			{
				reserved(_capacity * 2);
			}
			_str[_size] = d1;
			_size++;
		}
		void test1()
		{
			cout << _str << endl;
		}
	private:
		char* _str;
		size_t _size;
		size_t _capacity;
	};
}

//ostream& operator<<(ostream out,string d1)
//{
//	for (int i = 0; i < d1.size();i++)
//	{
//		out << d1[i];
//	}
//	return out;
//}